#!/usr/bin/env bash

#

# 可以先同步下公钥免密登录 ssh-copy-id -i ~/.ssh/id_dsa.pub –p 22 ljg@123.207.34.45

CURRENT_DIR=$(cd $(dirname $0); pwd)

cd $CURRENT_DIR

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build

#kill
ssh 192.168.2.88 "ps -ef | grep /opt/estore/center | grep -v grep | awk ' {print \$2}' | xargs kill -9 || echo '没找到center进程，kill失败'"
#上传
scp center 192.168.2.88:/opt/estore/
rm center
#启动
ssh 192.168.2.88 "bash /opt/estore/run.sh"
#ssh ljg@192.168.2.88 "nohup /opt/estore/center run --defaults=test --config=/opt/estore/config.yaml 2>&1>>/opt/estore/run.log &"



